package com.freight.user.controller;

import com.freight.core.base.FreightBaseController;
import com.freight.core.common.utils.PageUtil;
import com.freight.core.common.utils.ResultUtil;
import com.freight.core.common.vo.PageVo;
import com.freight.core.common.vo.Result;
import com.freight.core.common.vo.SearchVo;
import com.freight.user.entity.UserFeedback;
import com.freight.user.service.UserFeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author huyingtai
 */
@Slf4j
@RestController
@Api(description = "用户返回管理接口")
@RequestMapping("/freight/userFeedback")
@Transactional
public class UserFeedbackController extends FreightBaseController<UserFeedback, Long> {

    @Autowired
    private UserFeedbackService userFeedbackService;

    @Override
    public UserFeedbackService getService() {
        return userFeedbackService;
    }


    @RequestMapping(value = "/getByCondition", method = RequestMethod.GET)
    @ApiOperation(value = "多条件分页获取")
    public Result<Page<UserFeedback>> getByCondition(UserFeedback userFeedback, SearchVo searchVo, PageVo pageVo) {

        Page<UserFeedback> page = userFeedbackService.findByCondition(userFeedback, searchVo, PageUtil.initPage(pageVo));
        return new ResultUtil<Page<UserFeedback>>().setData(page);
    }

}
